package com.amumu.drama.common.modules.order.mapper;

import com.amumu.drama.common.base.mapstruct.BaseMapping;
import com.amumu.drama.common.base.mapstruct.ext.LocalDateTimeToStringMapping;
import com.amumu.drama.common.modules.order.dto.OmsOrderDetail;
import com.amumu.drama.common.modules.order.dto.resp.OmsOrderDetailResp;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

/**
 * @author sunzhuang
 * @date 2024/7/2 16:10
 * @slogan 天下风云出我辈, 一入代码岁月催
 * @desc todo
 */
@Mapper(componentModel = "spring")
public interface OmsOrderDetailRespMapping extends BaseMapping<OmsOrderDetail, OmsOrderDetailResp>, LocalDateTimeToStringMapping {


    OmsOrderDetailRespMapping INSTANCE = Mappers.getMapper(OmsOrderDetailRespMapping.class);

    /**
     * 正向映射的后置处理，List映射会自动继承此配置
     *
     * @param src
     * @param dest
     */
    @Override
    default void afterConvertTo(OmsOrderDetail src, OmsOrderDetailResp dest) {
        dest.setOrderItemList(OmsOrderItemRespMapping.INSTANCE.convertTo(src.getOrderItemList()));
    }
}
